
# BehaviorGenerator.rb

require 'rexml/document'

module BehaviorGenerator
  
  include REXML

  def create_terminal(name, set)
    element      = Element.new(name)
    element.text = random_choice(set)
    return element
  end

  def create_nonterminal(name, derivations)
    element = Element.new(name)
    derivations.each do |derivation|
      element << eval(derivation)
    end
    return element
  end

  def create_branch(choices)
    eval(random_choice(choices))
  end

end
